package com.x.erp.service;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.alibaba.dubbo.config.annotation.Service;
import com.x.erp.dao.BrandDao;
import com.x.erp.model.Brand;
import com.x.erp.rpc.BrandRpcService;
import com.x.framework.exception.BusinessException;
import com.x.framework.exception.ExceptionCode;
import com.x.framework.service.BaseService;

@Component
@Service(interfaceName = "com.x.erp.rpc.BrandRpcService", timeout = 60000)
public class BrandService extends BaseService implements BrandRpcService {

	@Autowired
	private BrandDao brandDao;
	
	@Override
	public List<Brand> selectBrandList(Brand brand) {
		try {
			return brandDao.selectBrandList(brand);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0009, e);
		}
	}

    @Override
    public void insertBrandList(Brand brand) {
        try {
            brandDao.insertBrandList(brand) ;
        } catch (Exception e) {
            throw new BusinessException(ExceptionCode.EXCEPTION_CODE0009, e);
        }
    }

    @Override
    public void updateBrandList(Brand brand) {
        try {
            brandDao.updateBrandList(brand) ;
        } catch (Exception e) {
            throw new BusinessException(ExceptionCode.EXCEPTION_CODE0009, e);
        }
    }

    @Override
    public Brand getSimpleBrand(Map<String, Object> brand) {
        try {
            return brandDao.getSimpleBrand(brand) ;
        } catch (Exception e) {
            throw new BusinessException(ExceptionCode.EXCEPTION_CODE0009, e);
        }
    }

}
